// Copyright (c) 2006 Zorm
// Released under the MIT License

#ifndef CONFIG_H
#define CONFIG_H
#pragma once

typedef std::map<tstring, DWORD> DwordMapType;
typedef std::map<tstring, DWORD>::iterator DwordMapTypeIter;
typedef std::map<tstring, tstring> StringMapType;
typedef std::map<tstring, tstring>::iterator StringMapTypeIter;

class Config {

public:
	Config(tstring configName) : m_configName(configName) { LoadDefaults(); }
	int LoadConfig();
	void AddConfigString(tstring name, tstring value);
	void AddConfigDWORD(tstring name, DWORD dwValue);
	void Clear();
	bool Save();
	DWORD GetDWORD(tstring name);
	tstring GetString(tstring name);
	void LoadDefaults();
	
private:
	
	enum {
		CONFIG_NORMAL,
		CONFIG_CPLUSPLUS_COMMENT,
		CONFIG_C_COMMENT,
		CONFIG_BASH_COMMENT,
		CONFIG_NAME,
		CONFIG_VALUE_START,
		CONFIG_VALUE_STRING,
		CONFIG_VALUE_NUMBER,
	};

	DwordMapType m_dwordMap;
	StringMapType m_stringMap;
	tstring m_configName;


};

#endif